import { CHANGE_CURRENT_ID, CHANGE_CURRENT_TAB } from '../constants/ActionTypes';

const initialState = {
  currentId: '',
  clickedTabIdx: 1,
};

const file = (state = initialState, action) => {
  switch (action.type) {
    case CHANGE_CURRENT_ID:
      return Object.assign({}, state, {
        currentId: action.selectedFileID,
      });
    case CHANGE_CURRENT_TAB:
      return Object.assign({}, state, {
        currentTabIdx: action.clickedTabIdx,
      });
    default:
      return state;
  }
};

export default file;
